// vue 全局方法
exports.install = function(Vue) {
	Vue.prototype.navigateTo = function(url) {
		uni.navigateTo({
			url: url
		})
	};
	Vue.prototype.switchTab = function(url) {
		uni.switchTab({
			url: url
		})
	};
	Vue.prototype.redirectTo = function(url) {
		uni.redirectTo({
			url: url
		})
	};
	Vue.prototype.navigateBack = function(delta = 1) {
		let pages = getCurrentPages();
		if (pages.length == 1) {
			uni.switchTab({
				url: "/pages/index/index"
			})
		} else {
			uni.navigateBack({
				delta: delta
			})
		}
	};
}